<?php 
require_once(dirname(dirname(__FILE__)).'/helper.php');
global $header;
global $footer;
global $control;
global $message;
global $dictionary, $terms, $pageNav, $count, $query, $source_all_abbrs;

global $featureManager;
$header['title'] = 'Search result in '.$dictionary['title'];
$header['head'] = '';
$header['intro'] = '<em class="title">'.$dictionary['title'].'</em>';
$header['hasToolBar'] = TRUE;
$featureManager->apply("com.yizin.platform.site.header", $header);
$featureManager->apply("com.yizin.platform.site.footer", $footer);
$featureManager->apply("com.yizin.platform.site.control", $control);

?>
<?= $header['html']?>
<div class="container-L">
	<?=$control['html']?>
</div>
<div class="container-R">
	<?=Utils::showMessage($message)?>
	<?=Utils::loadSegment(dirname(__FILE__)."/segments/_s_dictionary_toolbar_.php")?>
	<?=Utils::loadSegment(dirname(__FILE__)."/segments/_s_dictionary_search_.php")?>
	<?=Utils::loadSegment(dirname(__FILE__)."/segments/_s_dictionary_category_.php")?>
	<p class="meta"><strong><?=$count?></strong> results contain "<strong><?=$query?></strong>"</p>
	<div class="vspacing-short"></div>
	<?php if($terms) {?>
	<table class="terms">
		<?php foreach($terms as $term) {?>
		<tr>
			<th>
				<em class="term"><?=$term['term']?></em>
			</th>
			<td>
				<ol>
				<?php foreach($term['definition'] as $definition) {?>
					<li serial="<?=$definition['serial']?>">
						<em class="definition"><?=$definition['definition']?></em>
						<br />
						<ul class="piece-little">
						<?php $comefroms = explode(',', $definition['comefrom']); foreach($comefroms as $comefrom) { ?>
							<li serial="<?=$comefrom?>"><a class="button source-single" href="<?=get_source_url($comefrom)?>"><?=$source_all_abbrs[$comefrom]?></a></li>
						<?php } ?>
						</ul>
						<div class="clear"></div>
					</li>
				<?php }?>
				</ol>
			</td>
		</tr>
		<?php }?>
	</table>
	<?php }?>
	<?=$pageNav?>
</div>
<?= $footer['html']?>
